#ifndef ORIGIN_IMAGE_MODEL_H
#define ORIGIN_IMAGE_MODEL_H

#include "ImageType.hpp"
#include "POSIX_MessageQueue.hpp"
#include "POSIX_Semaphore.hpp"
#include "POSIX_SharedMemory.hpp"
#include <functional>
#include <pthread.h>
#include <string>
#include <thread>
#include <vector>

class OriginImageModel {
public:
  OriginImageModel(const std::vector<std::string> &cameraIDList, long ImageSize,
                   std::function<void(const std::vector<ImageType> &)> func);
  virtual ~OriginImageModel();
  void Boot();

private:
  POSIX_MessageQueue controlMsgQueue;
  std::function<void(const std::vector<ImageType> &)> newImageCallback;
  long memSize;
  std::vector<POSIX_SharedMemory> sharedMemoryList;
  std::unique_ptr<POSIX_Semaphore> memory_lock;
  void GetMemoryCallback(std::string val);
  pthread_t threadID;
  std::thread workThread;
};

#endif
